﻿using System.Web.Security;
using System.Linq;

namespace OpenWaves.ActivityFeed.Web.Tests
{
    public class FakeRoleProvider: RoleProvider
    {
        public override bool IsUserInRole(string username, string roleName)
        {
            return FakeUserProfileProvider.Users[username].Roles.Contains(roleName);
        }

        public override string[] GetRolesForUser(string username)
        {
            return FakeUserProfileProvider.Users[username].Roles;
        }

        public override void CreateRole(string roleName)
        {
            throw new System.NotImplementedException();
        }

        public override bool DeleteRole(string roleName, bool throwOnPopulatedRole)
        {
            throw new System.NotImplementedException();
        }

        private readonly string[] Roles = new string[] {"manager", "employee", "administrator"};

        public override bool RoleExists(string roleName)
        {
            return this.Roles.Contains(roleName);
        }

        public override void AddUsersToRoles(string[] usernames, string[] roleNames)
        {
            throw new System.NotImplementedException();
        }

        public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames)
        {
            throw new System.NotImplementedException();
        }

        public override string[] GetUsersInRole(string roleName)
        {
            throw new System.NotImplementedException();
        }

        public override string[] GetAllRoles()
        {
            return this.Roles;
        }

        public override string[] FindUsersInRole(string roleName, string usernameToMatch)
        {
            throw new System.NotImplementedException();
        }

        public override string ApplicationName { get; set; }
    }
}